package com.test.jbpm.web.action;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.test.jbpm.Pager;
import com.test.jbpm.domain.TroubleTicket;
import com.test.jbpm.service.TroubleTicketService;


@Controller
@Scope("prototype")
public class ApprovedTroubleTicketAction extends AbtractTroubleTicketAction {

	private TroubleTicketService troubleTicketService;
	
	@Autowired
	public void setTroubleTicketService(TroubleTicketService troubleTicketService) {
		this.troubleTicketService = troubleTicketService;
	}
	
	public String index() throws Exception {
		return SUCCESS;
	}
	
	public String list() throws Exception {
		Pager<TroubleTicket> pager = troubleTicketService.findApprovedTroubleTicketList(currentUser().getId());
		return troubleTicket2JsonString(pager);
	}
}
